/* eslint-disable */
import Vue from 'vue';
import Vuex from 'vuex';
import { module1 } from './module1';
import { module2 } from './module2';

Vue.use(Vuex); 

export const store = new Vuex.Store({
  modules: {
    module1,
    module2
  },
  state: {
    count: 0,
    count1: 0,
  },
  mutations: {
    addCount: function(state, payload) {
      state.count += payload;
    },
    minusCount: function(state, payload) {
      state.count -= payload;
    },
    addCount1: function(state, payload) {
      state.count1 += payload;
    },
    minusCount1: function(state, payload) {
      state.count1 -= payload;
    }
  },
  actions: {
    addCountAsync: function(context, payload) {
      setTimeout(() => {
        context.commit('addCount', payload);
      }, 1000);
    },
    minusCountAsync: function(context, payload) {
      setTimeout(() => {
        context.commit('minusCount', payload);
      }, 1000);
    },
    addCount1Async: function(context, payload) {
      setTimeout(() => {
        context.commit('addCount1', payload);
      }, 1000);
    },
    minusCount1Async: function(context, payload) {
      setTimeout(() => {
        context.commit('minusCount1', payload);
      }, 1000);
    },
  }
});